<%--
  Created by IntelliJ IDEA.
  User: lenovo
  Date: 2024/4/24
  Time: 20:24
  To change this template use File | Settings | File Templates.
--%>
<%--<%@ page contentType="text/html;charset=UTF-8" language="java" %>--%>
<%--<html>--%>
<%--<head>--%>
<%--    <title>Title</title>--%>
<%--</head>--%>
<%--<body>--%>

<%--</body>--%>
<%--</html>--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Title</title>
    <style>
        input{
            height: 30px;
            font-size: 20px;
        }
        li{
            display: inline-block;
        }
    </style>
</head>
<body style="background-color: #a6c1ee;background-repeat: no-repeat;background-size: cover">
<h1 style="text-align: center;margin-top: 30px">超市管理系统</h1>
<div style="text-align: center">
    <form action="QueryProductServlet" method="post">
        <input name="keyword">
        <input type="submit" value="搜索">
    </form>
</div>
<div style="text-align: center;margin-top: 30px;margin-left: 400px;">
    <c:choose>
        <c:when test="${empty requestScope.list}">
            <p>数据为空</p>
        </c:when>
        <c:otherwise>
            <table border="1" cellpadding="5" cellspacing="0">
                <tr>
                    <th>商品ID号</th>
                    <th>商品名称</th>
                    <th>商品类别</th>
                    <th>进货价格</th>
                    <th>库存数量</th>
                    <th>供应商</th>
                    <th colspan="3">操作</th>
                </tr>
                <c:forEach items="${requestScope.list}" var="product">
                    <tr>
                        <td>${product.id}</td>
                        <td>${product.name}</td>
                        <td>${product.type}</td>
                        <td>${product.price}</td>
                        <td>${product.number}</td>
                        <td>${product.guige}</td>
                        <td>${product.provider}</td>
                        <td><a href="FindProductServlet?id=${product.id}">修改</a></td>
                        <td><a href="DeleteProductServlet?id=${product.id}">删除</a></td>
                    </tr>
                </c:forEach>
            </table>
        </c:otherwise>
    </c:choose>
</div>
<div style="margin-left: 350px;">
    <ul>
        <li><a href="addProduct.jsp"><button style="width: 125px;height: 25px;background-color: white;border: black 1px solid;margin-left: 50px">添加商品</button></a></li>
        <li><a href="ShowAllServlet"><button style="width: 125px;height: 25px;background-color: white;border: black 1px solid;margin-left: 160px;">显示所有商品</button></a></li>
    </ul>
</div>

</body>
</html>

